<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <!-- MOTW-DISABLED saved from url=(0014)about:internet -->
    <title>Build a data set</title>
    <link rel="StyleSheet" href="css/crosstab.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="webworks.css" type="text/css" media="all" />
    <script type="text/javascript" language="JavaScript1.2">
      <!--
        var  WebWorksRootPath = "";
      // -->
    </script>
  </head>
  <body>
    <div style="text-align: left;">
      <table cellspacing="0" summary="">
        <tr>
          <td>
            <a href="ct-TutT2BuildADataSource.html"><img src="images/prev.gif" alt="Previous" border="0" /></a>
          </td>
          <td>
            <a href="ct-TutT4SetUpDataForTheCrossTab.html"><img src="images/next.gif" alt="Next" border="0" /></a>
          </td>
        </tr>
      </table>
    </div>
    <hr align="left" />
    <blockquote>
      <h3 class="N_TutorialTask">Task 3:&nbsp;&nbsp;<a name="220680">Build a data set</a></h3>
      <p class="b_Body"><a name="220683">In this procedure, you build a data set to indicate what data to extract from the Customers, OrderDetails, and Products tables.</a></p>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220684">In Data Explorer, right-click Data Sets, and choose New Data Set.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220685">In New Data Set, type the following text for data set name:</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi_CodeFirstIndent"><a name="220686">Sales</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220690">Choose Next.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">4&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220692">Use the following SQL SELECT statement to indicate what data to retrieve. Type the column and table names, or drag them from Available Items to the appropriate location in the SELECT statement.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi_CodeFirstIndent"><a name="220746">SELECT Customers.state,</a></div>
      <div class="coi_CodeIndent"><a name="220748">Orderdetails.quantityOrdered,</a></div>
      <div class="coi_CodeIndent"><a name="220749">Orderdetails.priceEach,</a></div>
      <div class="coi_CodeIndent"><a name="220750">Products.productline</a></div>
      <div class="coi_CodeIndent"><a name="441796">&nbsp;</a></div>
      <div class="coi_CodeIndent"><a name="441797">FROM Customers INNER JOIN Orders ON Customers.customerNumber = Orders.customerNumber </a></div>
      <div class="coi_CodeIndent"><a name="220753">INNER JOIN Orderdetails ON Orders.orderNumber = Orderdetails.orderNumber </a></div>
      <div class="coi_CodeIndent"><a name="220754">INNER JOIN Products ON Orderdetails.productCode = Products.productCode</a></div>
      <div class="coi_CodeIndent"><a name="220755">&nbsp;</a></div>
      <div class="coi_CodeIndent"><a name="220700">WHERE Customers.country = 'USA'</a></div>
      <div class="N_i_Indent1"><a name="220759">This SELECT statement joins four tables to get the required data.</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">5&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220708">Choose Finish to save the data set. Edit Data Set displays the columns specified in the query, and provides options for editing the data set. </a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">6&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220846">Choose Computed Columns, then choose New to create a computed field that calculates extended prices by multiplying values from the QUANTITYORDERED and PRICEEACH fields.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">7&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220847">In New Computed Column, specify the following values, as shown in </a><a href="#306370" title="Build a data set">Figure&nbsp;16-2</a>:</div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="220856">In Column Name, type</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi2_CodeFirstIndent2"><a name="220861">EXTENDED_PRICE</a></div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="220860">In Data Type, select Float.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="220865">In Expression, type</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi2_CodeFirstIndent2"><a name="220866">row["QUANTITYORDERED"] * row["PRICEEACH"]</a></div>
      <div class="N_i2_Indent2"><a name="306361">Alternatively, open the expression builder to construct the expression by selecting the appropriate data set fields. Note that data set field names are case-sensitive. If you typed row["quantityOrdered"] in the Expression field, BIRT displays an error when you preview the results returned by the data set. The case requirement for data set field names is unlike the SELECT statement where you can type table field names in any case. </a></div>
      <p class="i3_Image3"><a name="306368"><img class="Default" src="images/xtab_computedcolumn.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 16-2 Computed field EXTENDED_PRICE" /></a></p>
      <div class="fc3_FigCall3Title">
        <b class="Bold">Figure&nbsp;16-2&nbsp;&nbsp;</b><a name="306370">Computed field EXTENDED_PRICE</a></div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">4&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="220897">Choose OK to save the computed field.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">8&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="306349">Choose Preview Results to confirm that the query returns the correct data. </a><a href="#306358" title="Build a data set">Figure&nbsp;16-3</a> shows some of the data rows that the data set returns.</div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i2_Image2"><a name="306356"><img class="Default" src="images/xtab_dspreview.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 16-3 Preview of rows returned by the Sales data set" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;16-3&nbsp;&nbsp;</b><a name="306358">Preview of rows returned by the Sales data set</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">9&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="220720">Choose OK to save the data set.</a></div>
            </td>
          </tr>
        </table>
      </div>
    </blockquote>
    <hr align="left" />
    <table align="right" summary="">
      <tr>
        <td class="WebWorks_Company_Name_Bottom">
          <a href="notices.html">(c) Copyright Actuate Corporation 2013</a>
        </td>
      </tr>
    </table>
  </body>
</html>